In quantum mechanics, for systems where the total number of particles may not be preserved, the number operator is the observable that counts the number of particles.
The number operator acts on Fock space. Given a Fock state composed of single-particle basis states :
with creation and annihilation operators and we define the number operator and we have:
where is the number of particles in state . The above equality can be proven by noting that
then